package com.lsh.payment.core.model.payenum;

import java.util.HashMap;
import java.util.Map;

/**
 * 退款状态
 * @author peter
 */
public enum RefundType {
    /**
     *
     */
    REFUND_ALL(1, "全单"),
    REFUND_SUB(2, "部分");

    private int value;
    private String name;

    RefundType(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static RefundType getPayStatus(int status) {
        for (RefundType it : RefundType.values()) {
            if (it.getValue() == status) {
                return it;
            }
        }
        return null;
    }

    private static Map<Integer, String> map = new HashMap<>(RefundType.values().length);

    static {
        for (RefundType payStatus : RefundType.values()) {
            map.put(payStatus.getValue(), payStatus.getName());
        }
    }

    public static Map<Integer, String> getPayStatusMap() {
        return map;
    }
}
